package com.haoshuang.zhouzhoubang.ui.adapter

import com.haoshuang.zhouzhoubang.databinding.ItemRemoveMemberBinding
import com.haoshuang.zhouzhoubang.model.bean.TeamGroupBean
import com.haoshuang.zhouzhoubang.ui.dialog.BjDialog3
import com.lxj.xpopup.XPopup
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter
import com.mufeng.libs.utils.view.clickWithTrigger
import com.mufeng.libs.utils.view.load

/**
 *
 */
class RemoveMemberAdapter(data: MutableList<TeamGroupBean.Member>) :
    BaseBindingQuickAdapter<TeamGroupBean.Member, ItemRemoveMemberBinding>(data) {

    override fun onBindViewHolder(
        holder: BaseBindingHolder,
        position: Int,
        item: TeamGroupBean.Member?
    ) {
        holder.getViewBinding<ItemRemoveMemberBinding>().apply {
            ivCheck.isSelected = item?.isChecked == true
            ivHead.load(item?.avatar)
            tvName.text = item?.nickname
            tvService.text = item?.service_names?.split(",")?.firstOrNull() ?: ""
            tvMore.clickWithTrigger {
                XPopup.Builder(context)
                    .asCustom(BjDialog3(context,
                        item?.service_names?.split(",") as ArrayList<String>
                    ) {

                    })
                    .show()
            }
        }
    }

}
